import { onShow } from '@dcloudio/uni-app'
import { useCommonThemeEffect } from '../effects/themeEffects'
import { ref } from 'vue'
var theme = ref('shiji')
export const themeMixin = {

  onShow(){
    const pages = getCurrentPages()
    // console.log('onShow-----mixin!',pages.length)
    if(pages.length ==0 ){
      return
    }
    const {  currentTheme ,navigationBar, tabBar} = useCommonThemeEffect()
    theme = currentTheme
    uni.setNavigationBarColor(navigationBar.value)
    uni.setTabBarStyle(tabBar.value)
  },
  computed: {
    currentTheme () {
      return theme.value;
    }
  }
}
